package com.ddwl.order.controller;

import com.ddwl.common.annotation.Auth;
import com.ddwl.common.constant.BaseEnum;
import com.ddwl.common.controller.BaseController;
import com.ddwl.order.service.StatisticsServer;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.order.StatisticsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 数据统计
 * @author wenbin
 */
@Api(tags = "数据统计")
@RestController
public class StatisticsController extends BaseController {
    

    @Resource
    private StatisticsServer statisticsServer;

    @GetMapping("/getStatistics")
    @Auth(product = {BaseEnum.ProductEnum.CONSOLE})
    @ApiOperation("数据统计接口(详细信息)")
    public RestVo<StatisticsVo> getStatistics(){
        StatisticsVo statisticsVo =statisticsServer.getStatistics();
        return RestVo.ok(statisticsVo);
    }

    @GetMapping("/getStatisticsNew")
    @Auth(product = {BaseEnum.ProductEnum.CONSOLE})
    @ApiOperation("数据统计接口")
    public RestVo<StatisticsVo> getStatisticsNew(){
        StatisticsVo statisticsVo =statisticsServer.getStatisticsNew();
        return RestVo.ok(statisticsVo);

    }
    @GetMapping("/test")
    @ApiOperation("数据统计接口")
    public RestVo test(){
        StatisticsVo statisticsVo =statisticsServer.test();
        return RestVo.ok(statisticsVo);
    }

    @GetMapping("/sentStatisticsMsg")
    //@Auth(product = {BaseEnum.ProductEnum.API})
    @ApiOperation("发送数据统计信息")
    public RestVo sentStatisticsMsg() throws Exception {
        statisticsServer.sentStatisticsMsg();
        return RestVo.ok();
    }



}
